package cn.shopifymall.camunda717.listener;

import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

/**
 * @Author 孤风雪影
 * @Email gitee.com/efairy520
 * @Date 2024/5/12 0:38
 * @Version 1.0
 */
@Component("checkHomeAddress")
public class CheckHomeAddressEndListener implements ExecutionListener {

    private static final String DEFAULT_ADDRESS = "用户注册地址";

    @Override
    public void notify(DelegateExecution delegateExecution) throws Exception {
        System.out.println("进入检查用户地址任务");
        String homeAddress = (String) delegateExecution.getVariable("homeAddress");
        if (StringUtils.isBlank(homeAddress)) {
            delegateExecution.setVariable("homeAddress", DEFAULT_ADDRESS);
        }
    }
}
